package com.dragons.spring5.aop.xml;

import com.dragons.spring5.aop.xml.detail.Add;
import com.dragons.spring5.aop.xml.detail.Chinese;
import org.junit.Test;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestAopXml {

    @Test
    public void testAdd(){
        BeanFactory context = new ClassPathXmlApplicationContext("aop-xml.xml");
        Book2 book2 = context.getBean("book2",Book2.class);
        book2.buy();
    }

    @Test
    public void aopDeclareParents(){
        BeanFactory context = new ClassPathXmlApplicationContext("aop-xml-detail.xml");
        Chinese person = (Chinese)context.getBean("person");
        person.Say();
        Add add = (Add)context.getBean("person");
        add.Todo();
    }
}
